package com.qianyu.core.entity.base;

import io.swagger.annotations.ApiModelProperty;

/**
 * @author wangzhic
 * @version create by Ztl on 2019/12/19 on 14:31
 */
public class PageDTO {

    public static final Integer DEFAULT_PAGE_NUM = 1;
    public static final Integer DEFAULT_PAGE_SIZE = 20;

    @ApiModelProperty("当前页")
    private Integer pageNum;

    @ApiModelProperty("每页数量")
    private Integer pageSize;

//    public Integer getBegin() {
//        if ((pageNum == null || pageNum < 1) && (pageSize == null || pageSize < 1)) {
//            return (DEFAULT_PAGE_NUM - 1) * DEFAULT_PAGE_SIZE;
//        }
//        return (pageNum - 1) * pageSize;
//    }

    /**
     * @param pageSize
     */
    public PageDTO(Integer pageSize) {
        this(pageSize, DEFAULT_PAGE_SIZE);
    }

    /**
     *
     */
    public PageDTO() {
        this(DEFAULT_PAGE_NUM, DEFAULT_PAGE_SIZE);
    }

    /**
     * @param pageNum
     * @param pageSize
     */
    public PageDTO(Integer pageNum, Integer pageSize) {
        if (pageSize < 1) {
            pageSize = 1;
        }
        this.pageNum = pageNum;
        this.pageSize = pageSize;
    }

    public Integer getPageNum() {
        return pageNum;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

}
